package cn.gailvlun.gll.net.group

import cn.gailvlun.gll.bean.PlaceHolder
import cn.gailvlun.gll.net.ListRes
import cn.gailvlun.gll.net.Member
import cn.gailvlun.gll.net.apartment.room.Room
import cn.gailvlun.gll.net.token.Authorization
import io.reactivex.Observable
import retrofit2.Call
import retrofit2.http.*

interface GroupService {
    @Authorization
    @POST("/owcp/chatgroup/")
    fun createGroup(@Body createGroup: CreateGroupReq): Observable<Room>

    @Authorization
    @GET("/owcp/chatgroupmember/")
    fun getGroupMember(@Query("room_id") roomId: Int): Observable<ListRes<Member>>

    @Authorization
    @GET("/owcp/chatgroupmember/")
    fun getGroupMemberSync(@Query("room_id") roomId: Int): Call<ListRes<Member>>

    @Authorization
    @DELETE("/owcp/chatgroupmember/")
    fun deleteMember(@Query("member_id") memberId: Int): Observable<PlaceHolder>

    @Authorization
    @PUT("/owcp/chatgroup/")
    fun modifyGroupName(@Body modifyGroupReq: ModifyGroupReq): Observable<Room>
}

class CreateGroupReq {
    var user_list: List<Int>? = null
}

class ModifyGroupReq {
    var room_id: Int? = null
    var name: String? = null
}



